<?php

namespace Telnet\Telnet\Strategy;

use React\Socket\ConnectionInterface;

class CmdMul implements CmdInterface {
    public static function handleCmd(array $argc, string $args, ConnectionInterface $connection) {
        if (count($argc) != 3) {
            $connection->write("arg error.\n");
            return;
        }
        if (!is_numeric($argc[1]) || !is_numeric($argc[2])) {
            $connection->write("arg error.\n");
            return;
        }

        $connection->write(($argc[1] * $argc[2]) . "\n");
    }
}